package cn.com.blueInfo.bpm.system.enums;

import cn.com.blueInfo.bpm.common.enums.BaseEnum;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 角色类型
 * @author suxch
 * @since 2025/8/28 22:25
 */
@Getter
@AllArgsConstructor
public enum RoleType implements BaseEnum<Integer> {

    /** 角色类型-系统角色 */
    SYSTEM_ROLE(1, "系统角色"),
    /** 角色类型-自定义角色 */
    CUSTOM_ROLE(2, "自定义角色");

    @EnumValue
    private final Integer code;

    @JsonValue
    private final String desc;

    public static RoleType getByCode(Integer code) {
        return BaseEnum.getByCode(RoleType.class, code);
    }

    @JsonCreator
    public static RoleType getByName(String name) {
        return BaseEnum.getByName(name, RoleType.class);
    }

}
